package com.xlabs.client.DTO;

import com.google.gwt.user.client.rpc.IsSerializable;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Reply data transfer object class.
 */
public class ReplyDTO implements Serializable, IsSerializable, EntityDTO
{
    /**
	 * 
	 */
	private static final long serialVersionUID = 103889232191684962L;

	/**
     * The text comment.
     */
    private String replyText;

    /**
     * Key in the form of encoded string.
     */
    private String encodedKey;

    /**
     * parent's reply.
     */
    private ReplyDTO parent;
    
    /**
     * List of replies to this reply. 
     */
    private List<ReplyDTO> replies = new ArrayList<ReplyDTO>();

    /**
     * createdBy.
     */
    private String createdBy;

    /**
     * createdOn.
     */
    private Date createdOn;

    /**
     * Public constructor for GWT.
     */
    public ReplyDTO() {
    }

    /**
     * Gets comment.
     *
     * @return comment.
     */
    public String getReplyText() {
        return replyText;
    }

    /**
     * Sets Comment.
     *
     * @param replyText The text comment.
     */
    public void setReplyText(String replyText) {
        this.replyText = replyText;
    }

    /**
     * Gets encodedKey
     *
     * @return Encoded key.
     */
    public String getEncodedKey() {
        return encodedKey;
    }

    /**
     * Sets encodedKey
     *
     * @param encodedKey Encoded key
     */
    public void setEncodedKey(String encodedKey) {
        this.encodedKey = encodedKey;
    }

    /**
     * Gets parent reply, or null if there's none.
     *
     * @return parent.
     */
    public ReplyDTO getParent() {
        return parent;
    }

    /**
     * Sets parent.
     *
     * @param parent parent.
     */
    public void setParent(ReplyDTO parent) {
        this.parent = parent;
    }

    /**
     * Gets createdBy.
     * @return createdBy.
     */
    public String getCreatedBy() {
        return createdBy;
    }

    /**
     * Sets createdBy.
     * @param createdBy createdBy.
     */
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets createdOn.
     * @return createdOn.
     */
    public Date getCreatedOn() {
        return createdOn;
    }

    /**
     * Sets createdOn.
     * @param createdOn createdOn.
     */
    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

	/**
	 * Setter for {@link #replies}
	 * @param replies list of replies to this reply.
	 */
    public void setReplies(List<ReplyDTO> replies) {
		this.replies = replies;
	}

	/**
	 * Getter for {@link #replies}
	 * @return list of replies to this reply.
	 */
    public List<ReplyDTO> getReplies() {
		return replies;
	}

	/**
	 * Adds a reply to the list of replies of this reply!
	 * @param replyDTO Reply to be added.
	 */
    public void addReply(ReplyDTO replyDTO) {
    	this.replies.add(replyDTO);
	}
}
